package com.vim.modules.web.service;

import com.vim.common.base.CrudServiceImpl;
import com.vim.common.utils.IdGen;
import com.vim.modules.web.dao.SysConfigMapper;
import com.vim.modules.web.model.SysConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SysConfigService extends CrudServiceImpl<SysConfig> {

    @Resource
    private SysConfigMapper sysConfigMapper;

    @Autowired
    public SysConfigService(SysConfigMapper mapper) {
        super(mapper);
    }

    @Override
    public int save(SysConfig entity) {
        entity.setConfigId(IdGen.uuid());
        return super.save(entity);
    }

    /**
     * 根据code查找
     * @param configCode
     */
    public SysConfig findByCode(String configCode){
        return sysConfigMapper.findByCode(configCode);
    }
}

